<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>箭头函数</title>
</head>
<body>
    <div></div>
    <script>
        //1、基本形式
        let fn = function(){
            return 'hello'
        }
        let fn1 = ()=>{
            return 'hello'
        }
        //2、简写如果只有一个参数可以省略括号,其他情况不可省略
        let fn2 = x=>{
            return 'hello'+x
        }
        //3、如果只有一行 返回值直接返回的函数 可省略 return 和 {}
        function f3(x){
            return x*x
        }

        let fn13 = x =>{return x*x}
        //简写
        let fn14 = x => x*x;


    </script>
</body>
</html>